package blogger

import "sync"

type LoggerLock struct {
	lock    sync.Mutex
	disable bool
}

func NewLock() *LoggerLock {
	return &LoggerLock{
		lock:    sync.Mutex{},
		disable: false,
	}
}

func (l *LoggerLock) Lock() {
	if !l.disable {
		l.lock.Lock()
	}
}

func (l *LoggerLock) UnLock() {
	if !l.disable {
		l.lock.Unlock()
	}
}

func (l *LoggerLock) Disable() {
	l.disable = true
}
